home *** CD-ROM | disk | FTP | other *** search
- # SpecTcl, by S. A. Uhler
- # Copyright (c) 1994-1995 Sun Microsystems, Inc.
- #
- # See the file "license.txt" for information on usage and redistribution
- # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- #
- # Menu generated from menubar.menu
- # menubar is a frame in your interface which the menu uses as its menu bar.
-
- proc menubar_menu {menubar args} {
-
-
- # this treats "." as a special case
- if {$menubar == "."} {
- set mbar_widget "."
- set menubar ""
- } else {
- set mbar_widget $menubar
- }
-
-
- set bind_widget [winfo toplevel $mbar_widget]
-
- $menubar configure -borderwidth 2
- $menubar configure -relief raised
- menubutton $menubar.mnu#1\
- -text File\
- -menu $menubar.mnu#1.menu\
- -underline 0
- pack $menubar.mnu#1 -side left
-
- menu $menubar.mnu#1.menu\
- -postcommand {}\
- -tearoff 0
-
- $menubar.mnu#1.menu add command\
- -label New\
- -underline -1\
- -command clear_all\
- -accelerator <Control-n>
-
- bind $bind_widget <Control-n> clear_all
-
-
- $menubar.mnu#1.menu add command\
- -label Open...\
- -underline -1\
- -command {catch {destroy .open}; open_ui [toplevel .open]}\
- -accelerator <Control-o>
-
- bind $bind_widget <Control-o> {catch {destroy .open}; open_ui [toplevel .open]}
-
-
- $menubar.mnu#1.menu add command\
- -label Save\
- -underline -1\
- -command {save_project $Current(project).$P(file_suffix) 1}
-
- $menubar.mnu#1.menu add command\
- -label {Save as ...}\
- -underline -1\
- -command {catch {destroy .save};save_ui [toplevel .save]}
-
- $menubar.mnu#1.menu add separator
- $menubar.mnu#1.menu add command\
- -label Quit\
- -underline -1\
- -command quit\
- -accelerator <Control-x>
-
- bind $bind_widget <Control-x> quit
-
-
- menubutton $menubar.mnu#8\
- -text Edit\
- -menu $menubar.mnu#8.menu\
- -underline 0
- pack $menubar.mnu#8 -side left
-
- menu $menubar.mnu#8.menu\
- -postcommand editmenu_active\
- -tearoff 0
-
- $menubar.mnu#8.menu add command\
- -label {Edit code}\
- -underline -1\
- -command {edit_code $Current(project)}\
- -accelerator <Control-e>
-
- bind $bind_widget <Control-e> {edit_code $Current(project)}
-
-
- $menubar.mnu#8.menu add command\
- -label {Widget options ...}\
- -underline -1\
- -command menu_widget\
- -accelerator <Control-w>
-
- bind $bind_widget <Control-w> menu_widget
-
-
- $menubar.mnu#8.menu add command\
- -label {Generic options ...}\
- -underline -1\
- -command menu_generic\
- -accelerator <Control-g>
-
- bind $bind_widget <Control-g> menu_generic
-
-
- $menubar.mnu#8.menu add separator
- $menubar.mnu#8.menu add command\
- -label Delete\
- -underline -1\
- -command delete_selected\
- -accelerator <Delete>
-
- bind $bind_widget <Key-Delete> delete_selected
-
-
- $menubar.mnu#8.menu add command\
- -label Cut\
- -underline -1\
- -command {to_clipboard; delete_selected 0}\
- -accelerator <Control-x>
-
- bind $bind_widget <Control-x> {to_clipboard; delete_selected 0}
-
-
- $menubar.mnu#8.menu add command\
- -label Copy\
- -underline -1\
- -command to_clipboard\
- -accelerator <Control-c>
-
- bind $bind_widget <Control-c> to_clipboard
-
-
- $menubar.mnu#8.menu add command\
- -label Paste\
- -underline -1\
- -command from_clipboard\
- -accelerator <Control-v>
-
- bind $bind_widget <Control-v> from_clipboard
-
-
- menubutton $menubar.mnu#17\
- -text Commands\
- -menu $menubar.mnu#17.menu\
- -underline 0
- pack $menubar.mnu#17 -side left
-
- menu $menubar.mnu#17.menu\
- -postcommand commandmenu_active\
- -tearoff 0
-
- $menubar.mnu#17.menu add command\
- -label {Build & Test}\
- -underline -1\
- -command {build_app $Current(project).$P(file_suffix) /usr/local/bin/bltt_wish}\
- -accelerator <Control-t>
-
- bind $bind_widget <Control-t> {build_app $Current(project).$P(file_suffix) /usr/local/bin/bltt_wish}
-
-
- $menubar.mnu#17.menu add command\
- -label {Kill test}\
- -underline -1\
- -command { catch {send $Current(test_app) {after 1 {exit 0}}}}
-
- $menubar.mnu#17.menu add command\
- -label {Attach scrollbars}\
- -underline -1\
- -command {set _Message [scroll_attach]}
-
- $menubar.mnu#17.menu add command\
- -label {Re-apply toolbar}\
- -underline -1\
- -command {eval $Current(repeat); set _Message "repeating: $Current(repeat)"}\
- -accelerator <Control-.>
-
- bind $bind_widget <Control-Key-period> {eval $Current(repeat); set _Message "repeating: $Current(repeat)"}
-
-
- menu $menubar.mnu#17.menu.mnu#22\
- -tearoff 0
-
- $menubar.mnu#17.menu add cascade\
- -label Navigate\
- -menu $menubar.mnu#17.menu.mnu#22\
- -underline -1\
- -command {}
-
- $menubar.mnu#17.menu.mnu#22 add command\
- -label {Next widget}\
- -underline -1\
- -command {short_cut Right}\
- -accelerator <Right>
-
- bind $bind_widget <Key-Right> {short_cut Right}
-
-
- $menubar.mnu#17.menu.mnu#22 add command\
- -label {Previous widget}\
- -underline -1\
- -command {short_cut Left}\
- -accelerator <Left>
-
- bind $bind_widget <Key-Left> {short_cut Left}
-
-
- $menubar.mnu#17.menu.mnu#22 add command\
- -label {Enter subgrid}\
- -underline -1\
- -command Key_down\
- -accelerator <Down>
-
- bind $bind_widget <Key-Down> Key_down
-
-
- $menubar.mnu#17.menu.mnu#22 add command\
- -label {Leave subgrid}\
- -underline -1\
- -command Key_up\
- -accelerator <Up>
-
- bind $bind_widget <Key-Up> Key_up
-
-
- menubutton $menubar.mnu#27\
- -text Preferences\
- -menu $menubar.mnu#27.menu\
- -underline 0
- pack $menubar.mnu#27 -side left
-
- menu $menubar.mnu#27.menu\
- -postcommand {}\
- -tearoff 0
-
- $menubar.mnu#27.menu add checkbutton\
- -label {Show grid}\
- -command toggle_grid\
- -underline -1\
- -variable Grid
-
- $menubar.mnu#27.menu add checkbutton\
- -label {Show help}\
- -command {test_help $P(help)}\
- -underline -1\
- -variable P(help)
-
- menubutton $menubar.mnu#30\
- -text Help\
- -menu $menubar.mnu#30.menu\
- -underline 0
- pack $menubar.mnu#30 -side left
-
- menu $menubar.mnu#30.menu\
- -postcommand {}\
- -tearoff 0
-
- $menubar.mnu#30.menu add command\
- -label about\
- -underline -1\
- -command about
-
- $menubar.mnu#30.menu add command\
- -label {getting started}\
- -underline -1\
- -command {html_help quick.html}\
- -accelerator <Help>
-
- bind $bind_widget <Key-Help> {html_help quick.html}
-
-
- $menubar.mnu#30.menu add command\
- -label help\
- -underline -1\
- -command html_help
-
- }
-
-
- #
- # Procedure to map user-supplied labels into actual widget names
- # Parameters are as follows:
- # menubar: Name of the frame widget which acts as the menubar
- # for the menu in your application.
- # itemlabel: The textual label appearing on the menu item.
- #
- # Note: For items in menus (radiobuttons, checkbuttons, commands,
- # separators, cascades) the name returned is the menu to which
- # that item belongs. Items in menus are not actually widgets.
- # To configure them, use entryconfigure:
- # <menu name> entryconfigure <label of item> -<option> <value>
- # For example:
- # set menu_name myMenu_getmenuname {.f "File"}
- # $menu_name entryconfigure "File" -background red
- #
- proc menubar_getmenuname {menubar itemlabel} {
-
-
- # this treats "." as a special case
- if {$menubar == "."} {
- set menubar ""
- }
-
- global menubar_map
- array set menubar_map {
- File $menubar.mnu#1
- {Previous widget} $menubar.mnu#17.menu.mnu#22
- New $menubar.mnu#1.menu
- {Widget options ...} $menubar.mnu#8.menu
- about $menubar.mnu#30.menu
- Copy $menubar.mnu#8.menu
- Quit $menubar.mnu#1.menu
- {Generic options ...} $menubar.mnu#8.menu
- Delete $menubar.mnu#8.menu
- {Attach scrollbars} $menubar.mnu#17.menu
- {Kill test} $menubar.mnu#17.menu
- Cut $menubar.mnu#8.menu
- Paste $menubar.mnu#8.menu
- {Save as ...} $menubar.mnu#1.menu
- {Enter subgrid} $menubar.mnu#17.menu.mnu#22
- {Build & Test} $menubar.mnu#17.menu
- Edit $menubar.mnu#8
- Navigate $menubar.mnu#17.menu
- Save $menubar.mnu#1.menu
- help $menubar.mnu#30.menu
- {getting started} $menubar.mnu#30.menu
- Help $menubar.mnu#30
- {Edit code} $menubar.mnu#8.menu
- {Show help} $menubar.mnu#27.menu
- Preferences $menubar.mnu#27
- Commands $menubar.mnu#17
- {Next widget} $menubar.mnu#17.menu.mnu#22
- Open... $menubar.mnu#1.menu
- {Leave subgrid} $menubar.mnu#17.menu.mnu#22
- {Re-apply toolbar} $menubar.mnu#17.menu
- {Show grid} $menubar.mnu#27.menu
- }
-
- if {[info exists menubar_map($itemlabel)]} {
- return [subst $menubar_map($itemlabel)]
- } else {
- return ""
- }
- }
-
-